//
//  InvitedUnloginListCell.swift
//  MT
//
//  Created by 陈悦 on 2020/5/11.
//  Copyright © 2020 张强. All rights reserved.
//

import UIKit
import MTCategory

class InvitedUnloginListCell: UITableViewCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    lazy var userHeadIcon: UIImageView = {
        let imageView = UIImageView()
        imageView.layer.cornerRadius = 22
        imageView.backgroundColor = .blue
        return imageView
    }()

    lazy var nameLabel: UILabel = {
        let l = UILabel()
        l.textColor = UIColor(hex:0x1d1a1a)
        l.font = PingFangSCSemiboldFont(16)
        l.text = "帅气小伙"
        return l
    }()
    
    lazy var chatBtn: UIButton = {
        let btn = UIButton()
        btn.backgroundColor = UIColor(hex:0x426bf2)
        btn.layer.cornerRadius = 4
        btn.setTitle("微信Ta", for: .normal)
        btn.setImage(UIImage(named: "wechat-white"), for: .normal)
        btn.setTitleColor(.white, for: .normal)
        btn.titleLabel?.font = PingFangSCSemiboldFont(12)
        return btn
    }()
    
    lazy var lineView: UIView = {
        let v = UIView()
        v.backgroundColor = UIColor(hex:0xd8d8d8)
        return v
    }()
    
    
    class func reuseIdentity() -> String {
        return "InvitedUnloginListCellID"
    }
    
    func bind(model: MTLuckyReportSubModel) {
            
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
        makeConstraint()
        contentView.backgroundColor = UIColor.theme.background
        backgroundColor = UIColor.theme.background
    }
    
    private func setupUI() {
        contentView.addSubview(userHeadIcon)
        contentView.addSubview(nameLabel)
        contentView.addSubview(chatBtn)
        contentView.addSubview(lineView)
    }
    
    private func makeConstraint() {
        
        userHeadIcon.snp.makeConstraints { (make) in
            make.left.equalTo(10)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(44)
        }
        
        nameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(userHeadIcon.snp.right).offset(10)
            make.centerY.equalToSuperview()
        }
        
        chatBtn.snp.makeConstraints { (make) in
            make.right.equalTo(-10)
            make.width.equalTo(84)
            make.height.equalTo(28)
            make.centerY.equalToSuperview()
        }    

        lineView.snp.makeConstraints { (make) in
            make.left.bottom.right.equalToSuperview()
            make.height.equalTo(0.5)
        }
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }

}
